package com.lsu.app.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lsu.app.bean.ScheduleCourse;
import com.lsu.app.service.ScheduleCourseService;
import com.lsu.app.mapper.ScheduleCourseMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 *
 * @description 针对表【schedule_course(课程表关联课程id)】的数据库操作Service实现
 * @Date 2023-11-07 18:43:44
 * @author hjj
 */
@Service
public class ScheduleCourseServiceImpl extends ServiceImpl<ScheduleCourseMapper, ScheduleCourse> implements ScheduleCourseService{
    private final ScheduleCourseMapper mapper;

    public ScheduleCourseServiceImpl(ScheduleCourseMapper mapper) {
        this.mapper = mapper;
    }

    @Override
    public void getScs(Integer scId, Integer newScId) {
        for (ScheduleCourse scheduleCourse : mapper.copyDate(scId)) {
            scheduleCourse.setScheduleId(newScId);
            mapper.insert(scheduleCourse);
        }
    }

    @Override
    public List<Integer> getIds() {
        return mapper.getIds();
    }
}




